All Questions
8 questions
2votes
0answers
54views
editing the array I've included instead of editing the file of included array php
In order to reduce time complexity, instead of loading (and then dumping to use it for later) the whole file into an array (It would be O(n) with n=number of lines), I have saved it as array into a ...
6votes
2answers
503views
Usage of Factory pattern for maintaing bookshelf having books, magazine and notes
I have tried to achieve the following task using Factory Pattern with PHP version 7.0. Define the classes and their methods (including parameters and return types) for a system that consist of a ...
1vote
2answers
8kviews
Creating default object from empty value in PHP?
Consider the following code. ...
2votes
1answer
261views
Equity data processing: Fast and/or efficient file writing using PHP
Problem This project gets the past ~20 days of an equity data (such as $AAPL, $AMZN, $GOOG) plus the current equity "quote" (which comes every 60 seconds using a free API) and estimates seven "real-...
0votes
2answers
237views
PHP alternative syntax confusion
Newbie to PHP. Trying to output the results of an array inside a foreach loop. I have got the following code but I cannot understand what to do with it next. Mainly; Where/how do I start and end ...
2votes
1answer
112views
Road tax data parser
I'm making a data parser for road tax data (costs) which parses a JSON file with all weird variable names, which the customer gave me. The costs are different on each vehicle type. The costs at some ...
1vote
1answer
127views
Is there any better way to fetch two tables in one statement or query?
The 'Do' method is for prepared statements and returns (by fetchall()). I am also using two looping statements. Is there any better way to fetch two tables in one statement or query? If not, what ...
34votes
5answers
154kviews
Modifying an array during a foreach loop [closed]
This question is always on my mind. I usually alter the array while looping through its keys, based on my gut feelings: ...